#ifndef THREAD_H
#define THREAD_H
#include<stdlib.h>
#include<pthread.h>
#include<unistd.h>
#include <QDebug>
#include<event2/event.h>
#include<event2/event_struct.h>
#include<event2/event_compat.h>


class Thread
{
public:
    Thread();
    void start();
    event_base* getbase();

protected:
    static void * worker(void*arg);//线程启动
    static void  readpipefd(evutil_socket_t fd,short s,void* arg);
    void run();  //线程运行逻辑
private:
    event_base* m_base;
    pthread_t m_pthreadid;

    int piperead;
    int pipewrite;
    event m_pipeevent;

};

#endif // THREAD_H
